
package com.work.test;

import java.io.Serializable;
import java.util.List;

import javax.xml.bind.annotation.*;

@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "customObject", propOrder = {"name", "label", "baseObject", "attribute"})
public class DsXmlCustomObject implements Serializable, Comparable<DsXmlCustomObject> {

	private static final long serialVersionUID = -4390402227620086358L;

	@XmlAttribute(name = "on", required = true)
	private String on;

	@XmlAttribute(name = "operation", required = true)
	private String operation;

	@XmlElement(required = true, name = "name")
	private String name;

	@XmlElement(required = true, name = "label")
	private String label;

	@XmlElement(required = true, name = "baseObject")
	private String baseObject;

	@XmlElement(required = false, name = "attribute")
	@XmlElementWrapper(required = false, name = "attributes")
	private List<DsXmlObjectAttribute> attribute;

	public String getOn()
	{
		return on;
	}

	public void setOn(String on)
	{
		this.on = on;
	}

	public String getOperation()
	{
		return operation;
	}

	public void setOperation(String operation)
	{
		this.operation = operation;
	}

	public String getName()
	{
		return name;
	}

	public void setId(String name)
	{
		this.name = name;
	}

	public String getLabel()
	{
		return label;
	}

	public void setLabel(String label)
	{
		this.label = label;
	}

	public String getBaseObject()
	{
		return baseObject;
	}

	public void setBaseObject(String baseObject)
	{
		this.baseObject = baseObject;
	}

	public List<DsXmlObjectAttribute> getAttribute()
	{
		return attribute;
	}

	public void setAttribute(List<DsXmlObjectAttribute> attribute)
	{
		this.attribute = attribute;
	}

	@Override
	public int compareTo(DsXmlCustomObject param)
	{
		if (on == null || param.on == null) {
			return 0;
		}

		Integer on1 = Integer.parseInt(on);
		Integer on2 = Integer.parseInt(param.on);

		return on1.compareTo(on2);
	}

}
